Skip to content

feat: add code quality checks#2

Merged
jonryser merged 4 commits intomainfrom
feat/code-quality
Mar 11, 2026
Merged

feat: add code quality checks#2
jonryser merged 4 commits intomainfrom
feat/code-quality

Conversation

@genui-scotty
Copy link
Copy Markdown
Contributor

@genui-scotty genui-scotty bot commented Mar 11, 2026

Summary

Adds ESLint, Prettier, and markdownlint code quality checks to the repo, following the pattern established in generalui/a3.

What's added

  • eslint.config.mjs — TypeScript-ESLint flat config with typescript-eslint/recommendedTypeChecked + eslint-config-prettier to disable conflicting rules
  • .prettierrcsingleQuote, no semi, trailingComma: all, printWidth: 120 (matches a3)
  • .prettierignore — Excludes dist/, coverage/, *.md, *.yml, *.yaml
  • .markdownlint-cli2.jsonc — Markdown linting config (line length 280, inline HTML allowlist)
  • tsconfig.eslint.json — Extends the compiler config to include test/** for type-checked linting
  • .tool-versionsnodejs 20 (matches existing publish.yml)
  • .github/workflows/code-quality.yml — PR gate: markdown lint + prettier check + ESLint + vitest coverage; path-filtered so it only runs when relevant files change
  • package.json — New scripts: lint, lint:project, lint:markdown, format, format:check, test:coverage; new devDeps: eslint, typescript-eslint, eslint-config-prettier, prettier, markdownlint-cli2, npm-run-all, @vitest/coverage-v8
  • Prettier auto-format — All existing source and test files formatted in this commit

⚠️ Existing lint violations

The CI will not pass until the following violations in the existing source are resolved. These are real issues surfaced by the new rules — they should be fixed in follow-up commits on this branch before merge.

File Violations
src/event-router.ts complexity (29/20), max-depth (5/4), no-base-to-string (×6), no-redundant-type-constituents
src/index.ts complexity (23/20), no-duplicate-imports, no-floating-promises, no-unsafe-argument, no-await-in-loop, require-atomic-updates
src/tools/linear-view-tool.ts complexity (33/20), no-duplicate-imports, restrict-template-expressions
src/tools/linear-issue-tool.ts complexity (21/20), no-duplicate-imports
src/tools/linear-comment-tool.ts no-duplicate-imports
src/tools/linear-project-tool.ts no-duplicate-imports
src/tools/linear-relation-tool.ts no-duplicate-imports
src/tools/linear-team-tool.ts no-duplicate-imports
src/tools/queue-tool.ts no-duplicate-imports
src/webhook-handler.ts no-base-to-string (×4)
test/event-router.test.ts no-duplicate-imports
test/tools/linear-comment-tool.test.ts no-unsafe-return, no-unsafe-assignment, no-unsafe-member-access

The no-duplicate-imports violations are likely caused by separate value/type imports from the same module — these can be merged into a single import with import { Foo, type Bar } syntax.

The complexity and max-depth violations indicate functions that should be refactored.

The no-base-to-string violations indicate TypeBox schema fields being used in template literals where the type is string | object — these need explicit .toString() calls or type narrowing.

genui-scotty[bot] added 4 commits March 11, 2026 15:08
- Add eslint.config.mjs with typescript-eslint + eslint-config-prettier
- Add .prettierrc and .prettierignore (matching a3 config)
- Add .markdownlint-cli2.jsonc
- Add tsconfig.eslint.json (includes src/ and test/)
- Add .tool-versions (nodejs 20)
- Add .github/workflows/code-quality.yml
- Update package.json: lint, format:check, test:coverage scripts + devDeps
- Auto-format existing source files via prettier --write

Note: existing source has lint violations that need follow-up fixes.
- Merge duplicate imports from openclaw/plugin-sdk across all tool files
- Fix no-base-to-string: add toId() helper in event-router, type narrowing in webhook-handler
- Fix no-redundant-type-constituents: unknown|undefined -> unknown
- Refactor handleIssueUpdate (complexity 29->4): extract handleAssigneeChanges,
  handleStateChange, handlePriorityChange sub-functions
- Refactor activate (complexity 23->7): extract resolvePluginConfig()
- Refactor linear-view-tool execute (complexity 33->4): extract listViews, getView,
  createView, updateView, deleteView helpers
- Refactor updateIssue (complexity 21->4): extract resolveUpdateInput()
- Fix no-floating-promises: void handleAfterToolCall pattern
- Fix no-await-in-loop: Promise.all in deactivate
- Fix require-atomic-updates: capture debouncer before clearing activeDebouncer
- Fix no-unsafe-argument: eslint-disable on registerHttpRoute cast
- Fix restrict-template-expressions: cast action as string in view tool
- Disable unsafe rules for test files (vitest vi.fn() returns any)
- Add placeholder describe.todo for empty linear-api.test.ts
…event-router

- linear-api.test.ts (30 new tests, replaces empty placeholder):
  - graphql(): no API key, correct HTTP headers/body, data return,
    HTTP errors, GraphQL errors, missing variables
  - resolveIssueId(): valid format, uppercase team key, invalid formats,
    not found, caching behaviour, cache reset, independent caching
  - resolveTeamId(): happy path, uppercase key, not found
  - resolveStateId(): exact match, case-insensitive, multi-word,
    not-found error lists available states
  - resolveUserId(): by name, by email, not found
  - resolveLabelIds(): multiple labels, case-insensitive, empty list,
    not found, preserves input order
  - resolveProjectId(): happy path, not found

- linear-issue-tool.test.ts (6 new tests in update describe block):
  - appendDescription: appends to existing description with separator
  - appendDescription: sets directly when flag is false (single API call)
  - appendDescription: handles absent existing description (no prefix)
  - labels: passes resolved IDs to mutation input
  - dueDate: clears to null when empty string passed
  - dueDate: sets value when date string passed

- event-router.test.ts (1 new test):
  - triage state type → ignore (was missing from DEFAULT_STATE_ACTIONS coverage)
README.md:
- Remove duplicate H1 (MD025); consolidate fork note into a blockquote
- Add blank line before fenced code block inside list item (MD031)
- Break 647-char paragraph into sentence-per-line (MD013, max 280)
- Add missing trailing newline (MD047)

.github/ISSUE_TEMPLATE/bug_report.md:
- Convert all bold section headers to ### headings (MD036)
- Add blank lines around list items (MD032)
Copy link
Copy Markdown
Contributor

@jonryser jonryser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jonryser jonryser merged commit 9b56145 into main Mar 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant